<html>
<head>
<title>列表控件设定</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<import type="css" file="css.workform" />
<script>
function my_submit()
{
if(ITEM_NAME.value=="")
{
	 alert("控件名称不能为空");
	 return;
}
var parent_window = parent.dialogArguments;
var option_str="";
var LV_TITLE="";
var LV_SIZE="";
var count=0;
var ITEM_MAX=50;
for(i=1;i<=ITEM_MAX;i++)
{
		var item_str="item_"+i;
		var size_str="size_"+i;
		if(document.all(item_str).value!="")
		{
			LV_TITLE+=document.all(item_str).value+"`";
			count++;
			if(document.all(size_str).value!="")
				 LV_SIZE+=document.all(size_str).value+"`";
			else
				 LV_SIZE+="10`";
		}
}
if(count==0)
{
	 alert("表头项目不能为空");
	 return;
}
//var control_html="<img src=\\"listview.gif\\" class=\\"LIST_VIEW\\" align=absmiddle border=0 style=\\"cursor:hand\\" title=\\""+ITEM_NAME.value.replace("\\"","&quot;")+"\\" LV_TITLE=\\""+LV_TITLE+"\\" LV_SIZE=\\""+LV_SIZE+"\\">";
var control_html="<img src=\"listview.gif\" class=\"LIST_VIEW\" align=absmiddle border=0 style=\"cursor:hand\" title=\""+ITEM_NAME.value.replace("\\","&quot;")+"\" LV_TITLE=\""+LV_TITLE+"\" LV_SIZE=\""+LV_SIZE+"\" name=\"data_\">";
if(edit_flag==1)
{
	oSelection =  parent.dialogArguments.document.selection.createRange();
	oSelection(0).title=ITEM_NAME.value;
	parent_window.doStyle("delete");
	parent_window.insertHtml(control_html);
}
else
	parent_window.EDIT_HTML.insertHtml(control_html);
window.close();
}
//-- 获取控件属性 --
var edit_flag=0;
function LoadDo()
{
oSelection = dialogArguments.document.selection.createRange();
sRangeType = dialogArguments.document.selection.type;
if (sRangeType == "Control")
{
	edit_flag=1;
	ITEM_NAME.value = oSelection(0).title;
	var LV_TITLE = oSelection(0).LV_TITLE;
	var LV_SIZE = oSelection(0).LV_SIZE;
	var LV_TITLE_ARRAY=LV_TITLE.split("`");
	var LV_SIZE_ARRAY=LV_SIZE.split("`");
	for (i=0; i<LV_TITLE_ARRAY.length-1; i++)
	{
			var item_str="item_"+(i+1);
			var size_str="size_"+(i+1);
			document.all(item_str).value = LV_TITLE_ARRAY[i] ;
			document.all(size_str).value = LV_SIZE_ARRAY[i] ;
	}
}
ITEM_NAME.focus();
}
</script>
</head>
<body topmargin="0" onload="LoadDo();">
<table border="0" cellspacing="1" width="100%" class="small" bgcolor="#000000" cellpadding="3" align="center">
<tr class="TableContent">
		<td nowrap colspan="3">控件名称：
		<Input name="ITEM_NAME" type="text" class="SmallInput" size="20">
		<input type="button" onclick="my_submit();" value="确 定" class="SmallButton">
		</td>
</tr>
<tr class="TableHeader">
		<td nowrap align="center">序号</td>
		<td nowrap align="center" title="Tab键切换输入框">列表控件表头项目&nbsp;&nbsp;</td>
		<td nowrap align="center" title="Tab键切换输入框">宽度</td>
</tr>
<script type="text/javascript">
var ITEM_MAX=50;
for (I = 1; I <=ITEM_MAX; ++I)
{
	document.write("<tr class='TableContent'>");
	document.write("<td nowrap align='center'>");
	document.write(I);
	document.write("</td>");
	document.write("<td nowrap align='center' title='Tab键切换输入框'>");
	document.write("<Input name="+"item_"+I+" type='text' class='SmallInput' size='25'></td>");
	document.write("<td nowrap align='center' title='Tab键切换输入框'>");
	document.write("<Input name="+"size_"+I+" type='text' class='SmallInput' size='5' value='10'></td>");
	document.write("</tr>");
}
</script>
</table>
</body>
</html>